<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>AddPlanBasicInfo</title>
<link rel="stylesheet" type="text/css" href="../css/blueprint/screen.css" media="screen, projection"/>
<script type="text/javascript" src="../script/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$.getJSON("AddPlanPrepare.action",
            function(data) {
		        var kcfsArr = new Array();
		        for (var i = 0; i < data.kcfsList.length; i++) {
		        	kcfsArr.push('<option value="' + data.kcfsList[i].kcfsCode + '">' + data.kcfsList[i].kcfsName + '</option>');
		        }
		        $("#prjKcfscode").append(kcfsArr.join(''));
		        
		        var kzArr = new Array();
                for (var j = 0; j < data.kzList.length; j++) {
                    kzArr.push('<option value="' + data.kzList[j].kzCode + '">' + data.kzList[j].kzName + '</option>');
                }
                $("#prjKzcode").append(kzArr.join(''));
                
                var xmxzArr = new Array();
                for (var k = 0; k < data.xmxzList.length; k++) {
                    xmxzArr.push('<option value="' + data.xmxzList[k].xmxzCode + '">' + data.xmxzList[k].xmxzName + '</option>');
                }
                $("#prjXzcode").append(xmxzArr.join(''));

                loadTempSavedData();
			}
		);
		$("#tempSave").click(function() {
			$.getJSON("AddPlanTempSaveBasicInfo.action", 
				{
				    "tdfkfaMainEx.prjName": escape($("#prjName").val()),
				    "tdfkfaMainEx.prjXzcode": $("#prjXzcode").val(),
                    "tdfkfaMainEx.prjXmxzName": escape($("#prjXzcode option:selected").text()),
			        "tdfkfaMainEx.prjDistrictCode": $("#prjDistrictCode").val(),
			        "tdfkfaMainEx.prjUnit": escape($("#prjUnit").val()),
			        "tdfkfaMainEx.prjKcfscode": $("#prjKcfscode").val(),
			        "tdfkfaMainEx.prjKcfsName": escape($("#prjKcfscode option:selected").text()),
			        "tdfkfaMainEx.prjXmgm": $("#prjXmgm").val(),
			        "tdfkfaMainEx.prjKzcode": $("#prjKzcode").val(),
			        "tdfkfaMainEx.prjKzName": escape($("#prjKzcode option:selected").text())
				},
				function(data) {
                    if (data.tempSaveStatus == "success") {
                    	$(parent.LeftFrame.document).contents().find("#tempDataSaver").val("success");
                    } else if (data.tempSaveStatus == "failed") {
                        $(parent.LeftFrame.document).contents().find("#tempDataSaver").val("failed");
                    }
				}
			);
		});
	});
    function loadTempSavedData() {
    	$.getJSON("AddPlanTempLoadBasicInfo.action", 
            function(data) {
                if (data.tdfkfaMainEx != null) {
                	$("#prjName").val(unescape(data.tdfkfaMainEx.prjName));
                    $("#prjXzcode").val(data.tdfkfaMainEx.prjXzcode);
                    $("#prjDistrictCode").val(data.tdfkfaMainEx.prjDistrictCode);
                    $("#prjUnit").val(unescape(data.tdfkfaMainEx.prjUnit));
                    $("#prjKcfscode").val(data.tdfkfaMainEx.prjKcfscode);
                    $("#prjXmgm").val(data.tdfkfaMainEx.prjXmgm);
                    $("#prjKzcode").val(data.tdfkfaMainEx.prjKzcode);
                }

                watchDataEdited();
            }
        );
    }
    function watchDataEdited() {
        $("input[type='text'],select").change(function() {
            $(parent.LeftFrame.document).contents().find("#dataEditWatcher").val("changed");
            $(parent.LeftFrame.document).contents().find("#tempDataSaver").val("");
        });
    }
</script>
<style type="text/css">
<!--
.style1 {font-size: 36px}
-->
</style>
</head>
<body>
<table width="98%" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="20%" colspan="4"><div align="center" class="style1">
      <p>方案信息</p>
      <hr></hr>
    </div></td>
  </tr>
  <tr>
    <td width="20%" height="25"><div align="right">项目名称：</div></td>
    <td width="30%"><input name="text" type="text" id="prjName"/></td>
    <td width="20%" height="25"><div align="right">项目性质：</div></td>
    <td width="30%">
      <select id="prjXzcode" name="prjXzcode">
        <option value="">选择项目性质</option>
      </select>
    </td>
  </tr>
  <tr>
    <td width="20%" style="height: 19px"><div align="right">项目所在地：</div></td>
    <td width="30%" style="height: 19px"><input name="text2" type="text" id="prjDistrictCode"/></td>
    <td width="20%" style="height: 19px"><div align="right">项目单位：</div></td>
    <td width="30%" style="height: 19px"><input name="text2" type="text" id="prjUnit"/></td>
  </tr>
  <tr>
    <td width="20%" height="25"><div align="right">开采方式：</div></td>
    <td width="30%">
      <select id="prjKcfscode" name="prjKcfscode">
        <option value="">选择开采方式</option>
      </select>
    </td>
    <td width="20%" height="25"><div align="right">项目规模：</div></td>
    <td width="30%"><input name="text2" type="text" id="prjXmgm"/></td>
  </tr>
  <tr>
    <td width="20%"><div align="right">矿种：</div></td>
    <td width="30%">
      <select id="prjKzcode" name="prjKzcode">
        <option value="">选择矿种</option>
      </select>
    </td>
    <td width="20%" height="25">&nbsp;</td>
    <td width="30%">&nbsp;</td>
  </tr>
  <tr>
    <td width="20%" height="25"><div align="right">
        <input name="button" type="button" id="tempSave" value="暂存" />
    </div></td>
    <td width="30%">&nbsp;</td>
    <td width="20%" height="25">&nbsp;</td>
    <td width="30%">&nbsp;</td>
  </tr>
</table>
</body>
</html>